#include <bits/stdc++.h>
using namespace std;
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl
using ll = long long;
void solve()
{
    ll a1, a2, b1, b2;
    cin >> a1 >> a2 >> b1 >> b2;
    if(a1 > b1 )
    {
        cout << "B";
    }
    else if(a1<b1)
    {
       
        cout << "A";
    }
    else 
    {
        if(b2>a2)
        {
            cout << "A";
        }
        else
            cout << "B";
        }
}
int main()
{
    int t = 1;
    cin >> t;
    while(t--)
    {
        solve();
    }
   return 0;
}
